﻿using FastMvc.Crud.Models;
using FastMvc.Models;
using System;
using System.Collections.Generic;
using System.Text;
using System.Threading.Tasks;

namespace FastMvc.Crud
{
    public interface ICrudService<TEntity, TEntityDto, TPrimaryKey, TListPageRequestDto, TCreateDto, TUpdateDto> : IJQService
        where TEntity : DBEntity<TPrimaryKey>, new()
        where TEntityDto : DtoEntity<TPrimaryKey>
        where TListPageRequestDto : ListPageRequestDto, new()
    {
        Task<ListData<TEntityDto>> QueryList(TListPageRequestDto listPageRequest);

        Task<TEntityDto> QueryDetail(TPrimaryKey sId);

        Task<TEntityDto> CreateNew(TCreateDto createDto);

        Task<TEntityDto> Update(TPrimaryKey sId, TUpdateDto updateDto);

        Task<TEntityDto> Delete(TPrimaryKey sId);
    }


    public interface ICrudService<TEntity, TEntityDto, TPrimaryKey, TListPageRequestDto> : ICrudService<TEntity, TEntityDto, TPrimaryKey, TListPageRequestDto, TEntityDto, TEntityDto>
        where TEntity : DBEntity<TPrimaryKey>, new()
        where TEntityDto : DtoEntity<TPrimaryKey>
        where TListPageRequestDto : ListPageRequestDto, new()
    { }

    public interface ICrudService<TEntity, TEntityDto, TPrimaryKey> : ICrudService<TEntity, TEntityDto, TPrimaryKey, ListPageRequestDto>
        where TEntity : DBEntity<TPrimaryKey>, new()
        where TEntityDto : DtoEntity<TPrimaryKey>
    { }

    public interface ICrudService<TEntity, TEntityDto> : ICrudService<TEntity, TEntityDto, Guid>
        where TEntity : DBEntity<Guid>, new()
        where TEntityDto : DtoEntity<Guid>
    { }
}
